/**
 * @file output.c
 * @brief this is a brief description
 * @details this is the detail description.
 * @author fulong 
 * @data 6/28/2014
 * @version 1.0
 * @par Copyright (c):
 * @par First build
 *     version: fulong 
 *     data: 6/28/2014
 */
#include "output.h"
#include "io_configure.h"

#ifdef __STM32
    #include "../bsp/arch/stm32/stm32f1xx/STM32F10x_StdPeriph_Driver/inc/stm32f10x_gpio.h"
#endif

#define OPEN 1
#define CLOSE 0

#ifdef OUTPUT_TEST 
#ifdef __R8C
#define OUTPUT_VALUE (0)
#endif
#ifdef __STM32
#define OUTPUT_VALUE (Bit_RESET)
#endif
#else
#ifdef __R8C
#define OUTPUT_VALUE (1)
#endif
#ifdef __STM32
#define OUTPUT_VALUE (Bit_SET)
#endif
#endif

void output_init(void) {
    set_output_led_ctrl_output();
    OUTPUT_CTRL_ON();
#if OUTPUT_MAX_NUM > 0
    set_out0_output();
    output(0, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 1
    set_out1_output();
    output(1, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 2
    set_out2_output();
    output(2, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 3
    set_out3_output();
    output(3, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 4
    set_out4_output();
    output(4, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 5
    set_out5_output();
    output(5, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 6
    set_out6_output();
    output(6, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 7
    set_out7_output();
    output(7, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 8
    set_out10_output();
    output(10, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 9
    set_out11_output();
    output(11, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 10
    set_out12_output();
    output(12, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 11
    set_out13_output();
    output(13, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 12
    set_out14_output();
    output(14, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 13
    set_out15_output();
    output(15, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 14
    set_out16_output();
    output(16, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 15
    set_out17_output();
    output(17, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 16
    set_out20_output();
    output(20, OUTPUT_VALUE);
#endif
#if OUTPUT_MAX_NUM > 17
    set_out21_output();
    output(21, OUTPUT_VALUE);
#endif
}
